const DELIVERYMAN = 2
const ADMIN = 3

const keywords = {
  [DELIVERYMAN]: 'iamdeliveryman',
  [ADMIN]: 'iamadmin'
}

class User {
  constructor ({ username, password, state }) {
    this.username = username || ''
    this.password = password || ''
    this.state = state || 1
  }
  checkKeyword ({ keyword = '', state = 0 }) {
    if (state >= 2 && keywords[state] !== keyword) {
      return false
    }
    return true
  }
}

module.exports = User